<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../../Templates/SubFolderTemplate.xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name="head-title">
        <title>View Position | Merlion's ERP System</title>
    </ui:define>
    
    <ui:define name="content">
       <p:panel id="panel" header="View Positions">
        <h:form prependId="false">  

            <p:dataTable var="position" value="#{positionDataTableBean.positions}" dynamic="true" paginator="true" rows="5" emptyMessage="No position found in database." selection="#{positionDataTableBean.selectedPosition}">  
                
                <p:column selectionMode="single" />
                
                <p:column sortBy="#{position.id}"> 
                        <f:facet name="header"> 
                            <h:outputText value="ID" /> 
                        </f:facet> 
                        <h:outputText value="#{position.id}" /> 
                </p:column> 
                
                <p:column sortBy="#{position.description}">  
                    <f:facet name="header">  
                        <h:outputText value="Postion" />  
                    </f:facet>  
                    <h:outputText value="#{position.description}" />  
                </p:column>  

                <p:column>  
                    <f:facet name="header">  
                        <h:outputText value="Role" />  
                    </f:facet>  
                    <p:dataTable var="role" value="#{positionDataTableBean.getRoles(position.id)}" style="border-style: none;">
                        <p:column style="border-style: none;">
                            <p:row>
                                <h:outputText value="#{role.id}" />. <h:outputText value="#{role.description}" />
                            </p:row>
                        </p:column>
                    </p:dataTable>
                      
                </p:column>  
                
                <f:facet name="footer">  
                    <p:commandButton value="Edit" actionListener="#{positionDataTableBean.editPosition(event)}"/>     
                    <p:commandButton value ="Delete" actionListener="#{positionDataTableBean.deleteSaleLead(event)}"/>
                </f:facet>
                
            </p:dataTable>
        </h:form>
       </p:panel>
    </ui:define>

</ui:composition>
